//
//  NSDateFormatter+CAICategory.m
//  CAICategories
//
//  Created by 海参 on 2022/9/14.
//

#import "NSDateFormatter+CAICategory.h"

@implementation NSDateFormatter (CAICategory)


+ (NSString *)cailocalizedString1FromDate:(NSDate *)date
                             dateStyle:(NSDateFormatterStyle)dstyle
                             timeStyle:(NSDateFormatterStyle)tstyle{
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    formatter.dateStyle = dstyle;
    formatter.timeStyle = tstyle;
    formatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"zh_CN"];
    NSString *string = [formatter stringFromDate:date];
    return string;
}

+ (NSString *)cailocalizedString2FromDate:(NSDate *)date
                            dateFormat:(NSString *)format{
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
    formatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@"zh_CN"];
    formatter.dateFormat = format;
    NSString *string = [formatter stringFromDate:date];
    return string;
}

@end
